/**
 * 
 */
package fr.upvm.lem3.vm3d.ui.swing.dataload;

import java.awt.Color;
import java.awt.Component;
import java.awt.Point;

import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JTable;

import com.sun.xml.internal.bind.v2.schemagen.xmlschema.List;

/**
 * using just to custom a cell of a JCoponent 
 * @author Nougouapi
 *
 */
public class MyCustomCellrenderer extends DefaultListCellRenderer {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7456873445671290743L;

	public Component getListCellRendererComponent( JList<?> list, Object value, int index, boolean isSelected,boolean cellHasFocus){
			
		Component cell = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
		Color bgCol = cell.getBackground();
		if(isSelected){
			 cell.setBackground(new Color(0, 0, 255,25));
			 cell.setForeground(Color.black);
			 cell.setFocusable(true);
			 list.setToolTipText((String) value);
		}else{
				if (index % 2 == 0) {
	             cell.setBackground(new Color(250, 250, 250));
	            }
	            else {
	              cell.setBackground(new Color(210, 210, 210,50));
	            }
			 }
		if(cellHasFocus)
			list.setToolTipText((String)value);
		return cell;
	}

  }
